#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/4/2 15:44
# @Author  : Swper
# @Site    : 
# @File    : __init__.py.py
# @Software: PyCharm
from flask import Flask
from app.exts import db
from app.config import config
from app.models import *
from app.filters import string_time
from app.menu import page_config

def create_app():
    app = Flask(__name__)
    app.config.from_object(config['test'])
    app.add_template_filter(string_time)
    app.config.from_object(page_config)

    #导入模块admin,home
    from .admin import admin
    from .home import home

    #注册蓝本路由
    app.register_blueprint(home)
    app.register_blueprint(admin,url_prefix='/admin')

    db.init_app(app)
    return app